/*
 * @Descripttion: 
 * @version: 
 * @Author: wangzhilei
 * @Date: 2021-10-06 07:09:57
 * @LastEditors: wangzhilei
 * @LastEditTime: 2021-10-06 07:42:48
 */
#include <stdio.h>
#include<stdlib.h>
#include<signal.h>
#include<unistd.h>

void sa_sigaction_func(int signo,siginfo_t *info,void *p)
{
    printf("signo=%d\n",signo);
    printf("sender pid=%d\n",info->si_pid);
    printf("si_errno=%d\n",info->si_errno);
    printf("si_code=%d\n",info->si_code);
    printf("si_uid=%d\n",info->si_pid);
    printf("si_status=%d\n",info->si_status);
    printf("si_value=%d\n",info->_sifields._rt.si_sigval.sival_int);
    printf("si_fd=%d\n",info->si_fd);
}
int main(int argc,char *argv[])
{
    struct sigaction act,oact;

    sigemptyset(&act.sa_mask);
    act.sa_flags=SA_SIGINFO;
    act.sa_sigaction=sa_sigaction_func;
    sigaddset(&act.sa_mask,10);
    sigaction(SIGUSR1,&act,&oact);
    while (1)
    {
        printf("pid is %d Hello\n",getpid());
        pause();
    }
}